package com.zy.algorithm.curtain;

import com.zy.algorithm.bean.SortStepBean;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;

public class BaseSortScreenBean implements IScreenBean {

    //当前幕-是否需要动画
    boolean needScreenAnimation = false;

    //当前幕的子动画
    List<SortStepBean> cartoonStepBeanList;

    //当前幕 -开始和结束时数据结果 - 针对整个数组
    int[] sortScreenStart;
    int[] sortScreenEnd;

    //当前幕 -开始和结束时数据-已排序位置下标 - 针对整个数组
    List<Integer> sortedScreenStart = new ArrayList<>();//已排序数据下标
    List<Integer> sortedScreenEnd = new ArrayList<>();//已排序数据下标


    String describe = "";



    public BaseSortScreenBean() {
    }

    @Override
    public boolean isNeedScreenAnimation() {
        return needScreenAnimation;
    }

    @Override
    public List<Integer> getSubSetIndexList() {
        return new ArrayList<>();
    }

    public void setNeedScreenAnimation(boolean needScreenAnimation) {
        this.needScreenAnimation = needScreenAnimation;
    }

    @Override
    public List<SortStepBean> getCartoonStepBeanList() {
        return cartoonStepBeanList;
    }

    public void setCartoonStepBeanList(List<SortStepBean> cartoonStepBeanList) {
        this.cartoonStepBeanList = cartoonStepBeanList;
    }


    @Override
    public int[] getSortScreenStart() {
        return sortScreenStart;
    }

    public void setSortScreenStart(int[] sortScreenStart) {
        this.sortScreenStart = sortScreenStart;
    }


    @Override
    public int[] getSortScreenEnd() {
        return sortScreenEnd;
    }

    public void setSortScreenEnd(int[] sortScreenEnd) {
        this.sortScreenEnd = sortScreenEnd;
    }

    @Override
    public List<Integer> getSortedScreenStart() {
        return sortedScreenStart;
    }

    public void setSortedScreenStart(List<Integer> sortedScreenStart) {
        this.sortedScreenStart.addAll(sortedScreenStart);
    }

    public void setSortedScreenStart(HashSet<Integer> sortedScreenStart) {
        this.sortedScreenStart.addAll(sortedScreenStart);
    }

    @Override
    public List<Integer> getSortedScreenEnd() {
        return sortedScreenEnd;
    }

    public void setSortedScreenEnd(List<Integer> sortedScreenEnd) {
        this.sortedScreenEnd.addAll(sortedScreenEnd);
    }

    public void setSortedScreenEnd(HashSet<Integer> sortedScreenEnd) {
        this.sortedScreenEnd.addAll(sortedScreenEnd);
    }

    public void setSortedScreenEnd(int sortedIndex) {
        for (int i = 0; i < sortedIndex; i++) {
            sortedScreenEnd.add(i);
        }
    }

    public String getDescribe() {
        return describe;
    }

    public void setDescribe(String describe) {
        this.describe = describe;
    }

    @Override
    public String toString() {
        return "BaseSortScreenBean{" +
                "cartoonStepBeanList=" + (cartoonStepBeanList == null ? "null" : "" + cartoonStepBeanList.size()) +
                ", sortScreenStart=" + Arrays.toString(sortScreenStart) +
                ", sortScreenEnd=" + Arrays.toString(sortScreenEnd) +
                ", sortedScreenStart=" + sortedScreenStart +
                ", sortedScreenEnd=" + sortedScreenEnd +
                '}';
    }
}
